results = K_PhaseWave(-lfp1L.Data,eeg1L.Data,1024,1024,b,a,'randomization','none',...
'plotLinear',true,'plotCirc',true)


results =
binmean: [72×1 double]
binstd: [72×1 double]
binsem: [72×1 double]
axrad: [72×1 double]
meanvec: [1×1 struct]
bootstrap: [1×1 struct]
circshift: [1×1 struct]
fprintf('Vector length is only %.1f%% of SD of data\n',results.meanvec.length/std(-lfp1L.Data)*100)
Vector length is only 31.0% of SD of data
results = K_PhaseWave(bua1L.Data,eeg1L.Data,1024,1024,b,a,'randomization','none',...
'plotLinear',true,'plotCirc',true)


results =
binmean: [72×1 double]
binstd: [72×1 double]
binsem: [72×1 double]
axrad: [72×1 double]
meanvec: [1×1 struct]
bootstrap: [1×1 struct]
circshift: [1×1 struct]
fprintf('Vector length is only %.1f%% of SD of data\n',results.meanvec.length/std(bua1L.Data)*100)
Vector length is only 9.9% of SD of data
K_PhaseWave(bua1L.Data,eeg1L.Data,1024,1024, b, a,'randomization','none',...
'histtype','bar','histbin',36,...
'plotLinear',true,'plotCirc',true)


ans =
binmean: [36×1 double]
binstd: [36×1 double]
binsem: [36×1 double]
axrad: [36×1 double]
meanvec: [1×1 struct]
bootstrap: [1×1 struct]
circshift: [1×1 struct]
K_PhaseWave(bua1L.Data,eeg1L.Data,1024,1024, b, a,'randomization','none',...
'histtype','bar','histbin',72,...
'plotLinear',true,'plotCirc',true)


ans =
binmean: [72×1 double]
binstd: [72×1 double]
binsem: [72×1 double]
axrad: [72×1 double]
meanvec: [1×1 struct]
bootstrap: [1×1 struct]
circshift: [1×1 struct]
hlin = K_plotLinearPhaseWave(results,'Color',defaultPlotColors(2));
hlin = K_plotLinearPhaseWave(results,'XGrid','on');
hlin = K_plotLinearPhaseWave(results,'XGrid','off');
hlin = K_plotLinearPhaseWave(results,'plotType','bar');
hlin = K_plotLinearPhaseWave(results,'plotType','line');
hlin = K_plotLinearPhaseWave(results,'Title','This is a great plot!');
results = K_PhaseWave(bua1L.Data,eeg1L.Data,1024,1024,b,a,'randomization','none','HistBin',18);
results(2) = K_PhaseWave(bua2L.Data,eeg2L.Data,1024,1024,b,a,'randomization','none','HistBin',18);
results(3) = K_PhaseWave(bua3L.Data,eeg3L.Data,1024,1024,b,a,'randomization','none','HistBin',18)
results = 1×3 struct
| Fields | binmean | binstd | binsem | axrad | meanvec | bootstrap | circshift |
|---|
| 1 | 18×1 double | 18×1 double | 18×1 double | 18×1 double | 1×1 struct | 1×1 struct | 1×1 struct |
|---|
| 2 | 18×1 double | 18×1 double | 18×1 double | 18×1 double | 1×1 struct | 1×1 struct | 1×1 struct |
|---|
| 3 | 18×1 double | 18×1 double | 18×1 double | 18×1 double | 1×1 struct | 1×1 struct | 1×1 struct |
|---|
[results,handles] = K_PhaseWave(bua1L.Data,eeg1L.Data, 1024, 1024, b, a,...
'plotLinear',true,'plotcirc',true,'randomization','bootstrap');
[results,handles] = K_PhaseWave(bua1L.Data,eeg1L.Data, 1024, 1024, b, a,...
'plotLinear',true,'plotcirc',true,'randomization','circshift');
function [matname,eeg,wide] = local_getChan(chanSpec,S,I)
strongLFPBetaBZ = chanSpec.choose(...
chanSpec.ismatnamematched(regexptranslate('escape', S(I,:).parent))...
& (chanSpec.ischantitlematched(S(I,:).title) | chanSpec.ischan_EEG) ...
& chanSpec.ismatvalid(chanSpec.ischan_probeA00h));
matname = strrep(strongLFPBetaBZ.MatNames{1}, '.mat','');
eeg = strongLFPBetaBZ.constructChan(1,'IpsiEEG');
wide = strongLFPBetaBZ.constructChan(1,2); % supposedly beta containig LFP channel
eeg.plotPowerSpectrum(1024, 2048, 2048); % very clear beta in the EEG channel!!!
wide.plotPowerSpectrum(1024, 2048, 2048); % very clear beta in the LFP channel!!!
eeg.plotCohere(wide, 1024, 2048, 2048); % good beta in spike-EEG coherence as well
%--------------------------------------------------------------------------
function [eegL,lfpL,buaL] = local_getEEGLFPBUA(eeg,wide)
eegL = eeg.resample(1024);
Wn = normalizedfreq(300,wide.SRate);
[b,a] = butter(5,Wn,'low');
% fvtool(b,a,'Fs',wide.SRate);
lfp.Data = filtfilt(b,a,wide.Data);
lfpL = lfp.resample(1024);
lfpL.Data = lfpL.Data - mean(lfpL.Data);% mean subtraction
Wn = normalizedfreq(300,wide.SRate);
[b,a] = butter(5,Wn,'high');
high = filtfilt(b,a,wide.Data);
buaL = wide.getBUA('wideband thresholding',3,thre,...
'plotTriggered','on','plotwith','averageonly','spikewindow',[2,3],...
'meanadjustment','global');
buaL.plotPowerSpectrum(1024,2048,2048);
buaL.plotCohere(eegL,1024,2048,2048);